<%@ Page Language="C#" %>
<script runat="server">

    public class Index : System.Web.UI.Page{
            private void Page_Load(object sender, EventArgs e){
               Ajax.Utility.RegisterTypeForAjax(typeof(Index));
               //...
            }
            [Ajax.AjaxMethod()]
    public int ServerSideAdd(int firstNumber, int secondNumber)
    {
       return firstNumber + secondNumber;
    }
         }

</script>
<%@ Page Inherits="AjaxPlay.Sample" Codebehind="Index.aspx.cs" ... %>
<html>
 <head>
  <script language="javascript" src="ajax/common.ashx"></script>
  <script language="javascript"
          src="ajax/AjaxPlay.Sample,AjaxPlay.ashx"></script>
 </head>
  <body>
    <form id="Form1" method="post" runat="server">
      <script language="javascript">
        var response = Sample.ServerSideAdd(100,99);
        alert(response.value);
      </script>
    </form>
  </body>
</html>
